package com.example.github.io.stream.data;

import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;

/*
Java DataInputStream 类允许应用程序以与机器无关的方式从输入流中读取原始数据。
 */
public class DataInputStreamExample {
    public static void main(String[] args) throws IOException {
        FileInputStream fis = new FileInputStream("D:/logs/test1.txt");
        DataInputStream dis = new DataInputStream(fis);
        int count  = dis.available();
        byte[] bytes = new byte[count];
        dis.read(bytes);
        for (byte b : bytes) {
            System.out.print((char)b);
        }
        dis.close();
        fis.close();
    }
}
